<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <title>其他控制语句—try、catch、throw、continue</title>
</head>
<body>
<script>
  let arr2 = ["张三", "李四", "王五"];
  //try
  try {
    let i = 1;
    let type = typeof i;
    console.log("type=", type);
    //throw
    if (!("number" === type)) throw "必须是数字类型";
    if (i === 0) throw "被除数不能等于零";
    for (; i < arr2.length; i++) {
      if (i == 2) {
        //continue
        continue;
      }
      console.log(i + "====>" + arr2[i]);
    }
  } catch (err) { //catch
    console.log("err msg=>", err);
  }
</script>
</body>
</html>